﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace Maticsoft.Web
{
    public partial class Read : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request["a"]))
                {
                    Bind(int.Parse(Request["a"]));


                }
            }
        }

        private void Bind(int id)
        {
            Maticsoft.BLL.newsInfo nm = new BLL.newsInfo();
            Maticsoft.Model.newsInfo n = nm.GetModel(id);

            this.lbl_cotent.Text = n.newsContent;
            this.lbl_title.Text = n.newsTitle;
            this.lbl_time.Text = n.newsPubTime.Value.ToShortDateString();
            this.lbl_count.Text = n.newsCount.ToString();

            this.hy_url.Text = n.newsType;

            n.newsCount += 1;

            nm.Update(n);

        }
    }
}